﻿// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_QC_SAMPLING_PARAMETERS
// * CreateDate    : 2012/5/7 17:40:30
// * Creater       : CodeSmith
// * LastChangeDate: 2012/5/7 17:40:30
// * LastChanger   : 2012/5/7 17:40:30
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;
using ESOL.Common;

namespace ESOL.Business.Chk
{
    /// <summary>
    /// QcSamplingParameters
    /// </summary>
    public partial class QcSamplingParametersBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objQcSamplingParametersEntity">Entity</param>
        /// <returns>Entity</returns>
        public static QcSamplingParametersEntity GetQcSamplingParameters(QcSamplingParametersEntity objQcSamplingParametersEntity)
        {
            return DataAccess.SelectSingle<QcSamplingParametersEntity>(objQcSamplingParametersEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objQcSamplingParametersEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertQcSamplingParameters(QcSamplingParametersEntity objQcSamplingParametersEntity)
        {
            return DataAccess.Insert(objQcSamplingParametersEntity);
        }

        public static bool InsertQcSamplingParameters(List<QcSamplingParametersEntity> objQcSamplingParametersEntityList)
        {
            return DataAccess.Insert(objQcSamplingParametersEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objQcSamplingParametersEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateQcSamplingParameters(QcSamplingParametersEntity objQcSamplingParametersEntity)
        {
            return DataAccess.Update(objQcSamplingParametersEntity);
        }

        public static bool UpdateQcSamplingParameters(List<QcSamplingParametersEntity> objQcSamplingParametersEntityList)
        {
            return DataAccess.Update<QcSamplingParametersEntity>(objQcSamplingParametersEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objQcSamplingParametersEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteQcSamplingParameters(QcSamplingParametersEntity objQcSamplingParametersEntity)
        {
            return DataAccess.Delete(objQcSamplingParametersEntity);
        }

        public static bool DeleteQcSamplingParameters(List<QcSamplingParametersEntity> objQcSamplingParametersEntityList)
        {
            return DataAccess.Delete<QcSamplingParametersEntity>(objQcSamplingParametersEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetQcSamplingParametersAll()
        {
            return DataAccess.SelectAllDataSet<QcSamplingParametersEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<QcSamplingParametersEntity> GetQcSamplingParametersAllList()
        {
            return DataAccess.SelectAll<QcSamplingParametersEntity>();
        }
        #endregion

        #region Functions
        public static DataTable GetDtBySql(string sSql)
        {
            string Sql = sSql;
            return DataAccess.SelectDataSet(Sql).Tables[0];
        }

        public static bool Save(bool IsNew,QcSamplingParametersEntity Entity)
        {
            if (IsNew)
            {
                return DataAccess.Insert(Entity);
            }
            else
            {
                return DataAccess.Update(Entity);
            }
        }

        public static DataTable GetDtAllByCondition(string sCondition,string sRowCounts,string sOrderBy)
        {
            string sql = CommonFunctions.GetSelect(sRowCounts) + @" * from QC_SAMPLING_PARAMETERS where 1=1 ";
            if (string.IsNullOrEmpty(sCondition) == false)
                sql += sCondition;
            if (string.IsNullOrEmpty(sOrderBy) == false)
                sql += sOrderBy;
            return DataAccess.SelectDataSet(sql).Tables[0];
        }
        #endregion
    }


}

